﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Modules.crew.ui {
    import flash.display.*;
    import Mechanics.*;
    import flash.utils.*;
    import Display.DialogUI.*;
    import Classes.*;
    import Classes.util.*;
    import Mechanics.GameEventMechanics.*;

    public class RollCallDialog extends GenericDialog {

        protected var m_rollCallData:Array;
        protected var m_spawner:MechanicMapResource;
        protected var m_reopenCallback:Function;

        public function RollCallDialog(_arg1:MechanicMapResource, _arg2:Object=null, _arg3:Function=null, _arg4:Function=null){
            this.m_spawner = _arg1;
            this.m_reopenCallback = _arg4;
            this.loadObject(_arg2);
            super("dialog", "RollCallDialog", 0, _arg3, "RollCallDialog", "", false, 0, "", null, "");
        }
        protected function loadObject(_arg1:Object):void{
            var _local2:RollCallDataMechanic = (MechanicManager.getInstance().getMechanicInstance(this.m_spawner, "rollCall", MechanicManager.ALL) as RollCallDataMechanic);
            this.m_rollCallData = _local2.getCrewState();
        }
        override protected function createDialogView(_arg1:Dictionary):GenericDialogView{
            var _local2:RollCallDialogView = new RollCallDialogView(this.m_rollCallData, _arg1, m_message, m_dialogTitle, GenericDialogView.TYPE_OK, m_callback);
            return (_local2);
        }
        override protected function getAssetDependencies():Array{
            return ([DelayedAssetLoader.PAYROLL_ASSETS, DelayedAssetLoader.GENERIC_DIALOG_ASSETS, DelayedAssetLoader.MARKET_ASSETS, DelayedAssetLoader.UPGRADES_ASSETS]);
        }
        override protected function createAssetDict():Dictionary{
            var _local1:Dictionary = new Dictionary(true);
            var _local2:Object = m_assetDependencies[DelayedAssetLoader.GENERIC_DIALOG_ASSETS];
            _local1["dialog_div"] = _local2.dialog_rename_divider;
            _local1["vertical_scrollBar_border"] = _local2.vertical_scrollBar_border;
            _local1["btn_up_normal"] = _local2.gridlist_nav_up_normal;
            _local1["btn_up_over"] = _local2.gridlist_nav_up_over;
            _local1["btn_up_down"] = _local2.gridlist_nav_up_down;
            _local1["btn_down_normal"] = _local2.gridlist_nav_down_normal;
            _local1["btn_down_over"] = _local2.gridlist_nav_down_over;
            _local1["btn_down_down"] = _local2.gridlist_nav_down_down;
            _local1["cell_bg"] = _local2.cell_bg;
            _local1["cell_bg_alt"] = _local2.cell_bg_alt;
            _local1["pic_cashBtn"] = EmbeddedArt.icon_cash_big;
            _local1["pic_checkGreen"] = _local2.checkmark_green;
            _local1["pic_dot"] = _local2.gridList_page_dot;
            var _local3:Object = m_assetDependencies[DelayedAssetLoader.MARKET_ASSETS];
            _local1["card_available_selected"] = _local3.slices_card_active;
            var _local4:Object = m_assetDependencies[DelayedAssetLoader.UPGRADES_ASSETS];
            _local1["dialog_bg"] = (new _local4.upgrades_bg() as DisplayObject);
            var _local5:Object = m_assetDependencies[DelayedAssetLoader.PAYROLL_ASSETS];
            _local1["payroll_checkin_confirmCheckmark"] = _local5.payroll_checkin_confirmCheckmark;
            _local1["payroll_checkin_missingX"] = _local5.payroll_checkin_missingX;
            _local1["payroll_checkmark_reward"] = _local5.payroll_checkmark_reward;
            _local1["payroll_dividerGradient"] = _local5.payroll_dividerGradient;
            _local1["payroll_icon_clock"] = _local5.payroll_icon_clock;
            _local1["payroll_icon_responses"] = _local5.payroll_icon_responses;
            _local1["payroll_reward_coin"] = _local5.payroll_reward_coin;
            _local1["payroll_reward_energy"] = _local5.payroll_reward_energy;
            _local1["payroll_reward_xp"] = _local5.payroll_reward_xp;
            _local1["payroll_rewardArrow"] = _local5.payroll_rewardArrow;
            _local1["payroll_rewardBG_blue"] = _local5.payroll_rewardBG_blue;
            _local1["payroll_rewardBG_green"] = _local5.payroll_rewardBG_green;
            _local1["payroll_spinner"] = _local5.payroll_spinner;
            _local1["payroll_burst"] = _local5.payroll_burst;
            _local1["spawner"] = this.m_spawner;
            return (_local1);
        }
        override protected function onHideComplete():void{
            super.onHideComplete();
            if (this.m_reopenCallback != null){
                this.m_reopenCallback();
            };
        }
        override public function setupDialogStatsTracking():void{
            var _local2:Object;
            var _local3:RollCallDataMechanic;
            var _local1:Boolean;
            for each (_local2 in this.m_rollCallData) {
                if (_local2.checkedIn){
                    _local1 = false;
                    break;
                };
            };
            _local3 = (MechanicManager.getInstance().getMechanicInstance(this.m_spawner, "rollCall", MechanicManager.ALL) as RollCallDataMechanic);
            if (((((_local1) && (_local3))) && (_local3.isRollCallComplete()))){
                countDialogAction("no_one_checked_in");
            };
            super.setupDialogStatsTracking();
        }

    }
}//package Modules.crew.ui 
